package com.huobao.yunying.adapters;

import com.huobao.yunying.entity.StoreList;
import com.huobao.yunying.utils.ImageUtils;
import com.huobao.zhangying.R;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;
import joanzapata.android.BaseAdapterHelper;
import joanzapata.android.QuickAdapter;

public class Adapter_StoreList extends QuickAdapter<StoreList> {

	private boolean hideImage;

	public Adapter_StoreList(Context context) {
		super(context, R.layout.item_storelist);
		hideImage = false;
	}
	
	public Adapter_StoreList(Context context, boolean hideImage) {
		super(context, R.layout.item_storelist);
		hideImage = true;
	}


	@Override
	protected void convert(BaseAdapterHelper arg0, StoreList arg1) {
		final ImageView imageView = arg0.getView(R.id.imageview);
		ImageUtils.loadimg(imageView, arg1.getStore_logo());
		TextView tv = arg0.getView(R.id.tv_3);
		if(hideImage){
			tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
		}else{
//			tv.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.heart_1, 0, 0);
		}
		if (arg1.getService() != null && arg1.getService().equals("") == false
				&& arg1.getService().equals("null") == false) {
			arg0.setVisible(R.id.tv_2, true);
			arg0.setText(R.id.tv_2, "主营产品或服务:" + arg1.getService());
		} else {
			arg0.setVisible(R.id.tv_2, false);
		}
		if (arg1.getIndustry() != null && arg1.getIndustry().equals("") == false
				&& arg1.getIndustry().equals("null") == false) {
			arg0.setText(R.id.tv_3, "主营行业:" + arg1.getIndustry());
		} else {
			arg0.setText(R.id.tv_3, "");
		}
		arg0.setText(R.id.tv_1, arg1.getStore_name());
	}

}
